package observerpattern.example;

import observerpattern.ConcreteObserver;
import observerpattern.Subject;

/**
 * Created by hongchen on 2017/2/27.
 */
public class WeixinUser extends ConcreteObserver {
    //用于表明观测者自身的信息
    private String userName;
    //用与保存同步目标的状态
    private String  userState;

    public WeixinUser(String userName) {
        this.userName = userName;
    }

    @Override
    public void update(Subject subject) {
        userState = ((WeinxinGongzonghao)subject).getSubjectState();
        System.out.println(userName + "收到消息：" + userState);
    }
}
